<%@ page language="java" import="java.util.*" import="java.text.SimpleDateFormat" pageEncoding="UTF-8"%>
<%@ page import="com.bluesky.light.user.*" %>
<%@ page import="com.bluesky.light.staff.*" %>
<%@ page import="com.bluesky.light.client.*" %>
<%
	request.setCharacterEncoding("UTF-8");
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	// check if the user is login
	Staff s = (Staff)session.getAttribute("staff");
	if (s == null) {
		response.sendRedirect("/light");
	}	
	String name = s.getName();
%>
<%
	String action = request.getParameter("action");
	int id = -1;
	User u = (User)session.getAttribute("user");
	int toid = Integer.parseInt(request.getParameter("toid"));
	if (action != null && action.trim().equals("getinfo")) {
		id = Integer.parseInt(request.getParameter("id"));
		u = UserService.getInstance().loadById(id);
		session.setAttribute("user", u);
	}
	
	Cart c = (Cart)session.getAttribute("cart");
	if (c == null) {
		c = new Cart();
		session.setAttribute("cart", c);
	}
%>
<%
	if (action != null && action.trim().equals("prescription")) {
		String symptom = request.getParameter("symptom");
		c.setSymptom(symptom);
		response.sendRedirect("staff_userPrescripInput.jsp?toid=" + toid);
	}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>light</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="css/main.css" rel="stylesheet" type="text/css" />
	
  </head>
  
  <body>
	<!-- header -->
	<div id="header">
		<div id="logo"><img src="images/logo_small2.png"/></div>
	</div>
	<!-- // header -->
	<!-- nav -->
	<div id="nav">
	</div>
	<!-- // nav -->
	<!-- container -->
	<div id="container">
		<!-- contents -->
		<div id="contents">
	    	<div id="menu">
	        	<div>
	        		<div id="user_info">
	            		<img src="develop/user_icon.jpg"/> 
	            		<b>Staff</b>
	           		</div>
	           		<div>
	           		<%=name%>
	           		</div>
	            </div>
	            <div>
	            	<%SimpleDateFormat sdf = new SimpleDateFormat("EEE, yyyy-MM-dd", new Locale("US"));%><%=sdf.format(new Date())%><br></br>
	            </div>
	        	<ul>
	            	<li><a href="staff/home.jsp"><img src="images/news.png" /> Health News</a></li>
					<li><a href="staff/staff_getUserByDay.jsp"><img src="images/surscribe.png" /> Treatment of patients</a></li>
					<li><a href="staff/staff_infoModifyInput.jsp"><img src="images/account.png" /> Account Management</a></li>
					<li><a href="index.jsp"><img src="images/account.png" /> logout</a></li>             
					            
	            </ul>
	        </div>
	        <div id="main-cont">
	            <div id="result">
	            <form method="post" action="staff/staff_userSymptomDescr.jsp?toid=<%=toid%>">
	            		<input type="hidden" name="action" value="prescription"/>
		                <table class="resulttable" rules="all" >
		                	<caption>Symptom Description</caption>
		                	<tr><th colspan="2">User info.</th></tr>
							<tr><td>No.</td><td><%=u.getId()%></td></tr>
							<tr><td>Name</td><td><%=u.getName()%></td></tr>
							<tr><td>Sex</td><td><%=u.getSex()%></td></tr>
							<tr><td>Age</td><td><%=u.getBirth()%></td></tr>
							<tr><td>Register Time</td><td><%=u.getRdate()%></td></tr>
							<tr><th colspan="2">Symptom</th></tr>
							<tr><td colspan="2"><textarea name="symptom" cols="78" rows="10"></textarea></td></tr>
							<tr><td colspan="2"><input type="submit" value="Prescription" /></td></tr>
		                </table>	
		        </form>	
	        	</div>	        	
	    </div>
	    <!-- // contents -->
	</div>
	<!-- // container -->
	</div>
	<div id="footer">
		<div id="bs_stdio">
	    	©2011-2011 www.bluesky.com.mo All Rights Reserved<br/>
	    	<img src="images/bluesky_logo.png" />
	    </div>
	</div>
  </body>
</html>
